<?php
namespace App\Models;

/*
 * Mock travel destination data.
 * Note that we don't have to extend CodeIgniter's model for now
 */

class poet {

    //mock data : an array of records
    protected $data = [
        '1' => [
            'id' => 1,
            'name' => 'Han Yu',
            'Times' => 'the tang dynasty',
            'MainWorks' => 'On Buddha Bone Appearance, Teachers Theory and Learning Interpretation',
            'DateOfBirth' => '768',
            'DateOfDeath' => 'December 25, 824',
            'link' => 'https://baike.baidu.com/item/%E9%9F%A9%E6%84%88/127407',
            'image' => 'hanyu.jpg',
        ],
        '2' => [
            'id' => 2,
            'name' => 'Du Pu',
            'Times' => 'the tang dynasty',
            'MainWorks' => 'Watching the mountain, climbing high, looking at the spring, singing in the thatched cottage broken by the autumn wind, three officials, three farewells',
            'DateOfBirth' => 'February 12, 2012',   
            'DateOfDeath' => '770',
            'link' => 'https://baike.baidu.com/item/%E6%9D%9C%E7%94%AB/63508#:~:text=%E6%9D%9C%E7%94%AB%EF%BC%88712%E5%B9%B42%E6%9C%8812%E6%97%A5%20%EF%BD%9E770%E5%B9%B4%EF%BC%89%EF%BC%8C%E5%AD%97%E5%AD%90%E7%BE%8E%EF%BC%8C%E8%87%AA%E5%8F%B7%E5%B0%91%E9%99%B5%E9%87%8E%E8%80%81%EF%BC%8C%20%E5%94%90%E4%BB%A3,%E4%BC%9F%E5%A4%A7%E7%9A%84%E7%8E%B0%E5%AE%9E%E4%B8%BB%E4%B9%89%E8%AF%97%E4%BA%BA%EF%BC%8C%E4%B8%8E%20%E6%9D%8E%E7%99%BD%20%E5%90%88%E7%A7%B0%E2%80%9C%E6%9D%8E%E6%9D%9C%E2%80%9D%E3%80%82',
            'image' => 'dupu.jpg',
        ],
        '3' => [
            'id' => 3,
            'name' => 'Li Bai',
            'Times' => 'the tang dynasty',
            'MainWorks' => 'Meditation at night, difficult roads in Sichuan, Mingtang Fu, sleepwalking, Tianmu Chanting goodbye, difficult journey, going to wine, leaving Baidi City in the morning, and looking at Lushan Waterfall',
            'DateOfBirth' => 'February 28, 701 (the first year of Chang an)',
            'DateOfDeath' => 'December 762 (the first year of Baoying)',
            'link' => 'https://baike.baidu.com/item/%E6%9D%8E%E7%99%BD/1043',
            'image' => 'libai.jpg',
        ],
        '4' => [
            'id' => 4,
            'name' => 'Tao Yuan Ming',
            'Times' => 'Eastern Jin → Southern and Northern Dynasties',
            'MainWorks' => 'Collection of Tao Yuanming',
            'DateOfBirth' => 'About 365 years',
            'DateOfDeath' => '427 years',
            'link' => 'https://baike.baidu.com/item/%E9%99%B6%E6%B8%8A%E6%98%8E/53944',
            'image' => 'taoyuanming.jpg',
        ],
        '5' => [
            'id' => 5,
            'name' => 'Qu Yuan',
            'Times' => 'Late Warring States Period',
            'MainWorks' => 'Lisao, Jiuge, Jiuzhang, Tianwen',
            'DateOfBirth' => 'About 340 BC',
            'DateOfDeath' => '278 BC',
            'link' => 'https://baike.baidu.com/item/%E5%B1%88%E5%8E%9F/6109',
            'image' => 'quyuan.jpg',
        ],
    ];

    public function findAll() {
        return $this->data;
    }

    public function find($id = null) {
        if (!empty($id) && isset($this->data[$id])) {
            return $this->data[$id];
        }
        return null;
    }

}
